import React from 'react';
import { Route, Link } from 'react-router-dom';

import Style from './NavItem.less';

const NavItem = ({ label, to, activeOnlyWhenExact }) =>  {
	return (
		<Route path={to} exact={activeOnlyWhenExact} children={({match}) => (
			<li className={ match ? Style.active : '' }>
				<Link to={to}>{label + match}</Link>
			</li>
		)}/>
	)
}

export default NavItem;